﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Seesmic.Sdp.Extensibility;
using PTiRouZ.Net.SilverLight.Api.HelloTipi;
using Seesmic.Sdp.Utils;

namespace Seesmic.HelloTipi
{
    public class HelloTipiUserProfile : IProfile
    {
        public HelloTipiTimeLineItem ItemData { get; set; }
        public family_friends Contact { get; set; }
        
        public ICommand SendPrivateCommand
        {
            get
            {
                return new DelegateCommand(new Action(this.OnSendPrivateExecuted));
            }
        }

        public ICommand SendPublicCommand
        {
            get
            {
                return new DelegateCommand(new Action(this.OnSendPublicExecuted));
            }
        }

        public HelloTipiUserProfile()
        {

        }

        #region IProfile Members
               
        public DataTemplate ContentTemplate
        {
            get { return HelloTipiPlugin.HelloTipiProfileTemplate; }
        }

        public DataTemplate Icon
        {
            get
            {
                return HelloTipiPlugin.AccountIcon;
            }
        }

        public string Title
        {
            get { return String.Format("Profile de {0}", ItemData.UsernamewithoutFamily); }
        }

        #endregion

        public void OnSendPublicExecuted()
        {
            HelloTipiPlugin.PostingService.SetPostingContainer(new PostContainer(string.Format("@{0}", ItemData.Username)));
        }

        public void OnSendPrivateExecuted()
        {
            HelloTipiPlugin.PostingService.SetPostingContainer(new PostContainer(string.Format("d {0}", ItemData.Username)));            
        }
    }
}
